// IO函子
const fp = require("lodash/fp")
class IO {

  static of (x) {
    return new IO(function () {
      return x;
    })
  }

  constructor(fn) {
    this._value = fn
  }
  map(fn) {
    return new IO(fp.flowRight(fn, this._value))
  }
}

let io = IO.of(process)
  .map(x => x.execPath)
console.log(io._value())